services:
  agent:
    command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/dream_light/pipeline_conf.json'
    environment:
      WAIT_HOSTS: "dff-program-y-skill:8008, badlisted-words:8018, dff-friendship-skill:8086,
          dff-template-skill:8120, spelling-preprocessing:8074, combined-classification-lightweight:8150"
      WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-480}
      HIGH_PRIORITY_INTENTS: 1
      RESTRICTION_FOR_SENSITIVE_CASE: 1
      ALWAYS_TURN_ON_ALL_SKILLS: 0
      LANGUAGE: EN
      FALLBACK_FILE: fallbacks_dream_en.json

  spelling-preprocessing:
    env_file: [ .env ]
    build:
      context: ./annotators/spelling_preprocessing/
    command: flask run -h 0.0.0.0 -p 8074
    environment:
      - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 50M
        reservations:
          memory: 50M
  
  confidence-based-response-selector:
    build:
      args: 
        BADLIST_URL: http://badlisted-words:8018/badlisted_words
        FILTER_BADLISTED_WORDS: 1
      context: response_selectors/confidence_based_response_selector
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8005
    volumes: []
  
  dff-program-y-skill:
    env_file: [ .env ]
    build:
      args:
        SERVICE_PORT: 8008
        SERVICE_NAME: dff_program_y_skill
        LANGUAGE: EN
      context: .
      dockerfile: ./skills/dff_program_y_skill/Dockerfile
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8008 --reload
    deploy:
      resources:
        limits:
          memory: 1024M
        reservations:
          memory: 1024M

  badlisted-words:
    env_file: [ .env ]
    build:
      context: annotators/BadlistedWordsDetector/
    command: flask run -h 0.0.0.0 -p 8018
    environment:
      - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 256M
        reservations:
          memory: 256M

  dff-friendship-skill:
    env_file: [ .env ]
    build:
      args:
        SERVICE_PORT: 8086
        SERVICE_NAME: dff_friendship_skill # has to be the same with skill dir name
      context: .
      dockerfile: ./skills/dff_friendship_skill/Dockerfile
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8086
    # command:  flask run -h 0.0.0.0 -p 8086
    # environment:
    #   - FLASK_APP=server
    deploy:
      resources:
        limits:
          memory: 256M
        reservations:
          memory: 256M

  dff-template-skill:
    env_file: [ .env ]
    build:
      args:
        SERVICE_PORT: 8120
        SERVICE_NAME: dff_template_skill
      context: .
      dockerfile: ./skills/dff_template_skill/Dockerfile
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8120 --reload
    deploy:
      resources:
        limits:
          memory: 128M
        reservations:
          memory: 128M

  combined-classification-lightweight:
    env_file: [ .env ]
    build:
      args:
        CONFIG: combined_classifier.json
        SERVICE_NAME: combined_classification
        SERVICE_PORT: 8150
      context: .
      dockerfile: ./annotators/combined_classification_lightweight/Dockerfile
    command: gunicorn --workers=1 server:app -b 0.0.0.0:8150 --timeout 1200
    environment:
      CUDA_VISIBLE_DEVICES: ""
    deploy:
      resources:
        limits:
          memory: 2G
        reservations:
          memory: 2G
version: '3.7'
